import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<Object> products = new ArrayList<>();
        products.add("Product A");
        products.add("Product B");
        products.add("Product C");

        ProductList productList = new ProductList(products);
        Iterator iterator = productList.createIterator();

        System.out.println("正向遍历：");
        while (!iterator.isLast()) {
            System.out.println(iterator.getNextItem());
            iterator.next();
        }

        System.out.println("反向遍历：");
        while (!iterator.isFirst()) {
            System.out.println(iterator.getPreviousItem());
            iterator.previous();
        }
    }
}
